namespace import ::tcl::mathfunc::*

# Beam Fiber Section CORP YJK Section 1
proc Beam_Fiber_Section_Proc_1 { SecTag Width Height Cover Asup Asdown ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $Width $Height $Cover $ConcreteTag
        # As 
        Beam_As_Proc_1 $Width $Height $Cover $Asup $Asdown $ReinforcementTag
    }
}

# Rectangular concrete section
proc Concrete_rect_Proc_1 { Width Height Cover ConcreteTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY [int [ceil [expr $Width/$Dividing_scale]]]
    set numSubdivY [expr $numSubdivY>4?$numSubdivY:4]
    set numSubdivZ [int [ceil [expr $Height/$Dividing_scale]]]
    set numSubdivZ [expr $numSubdivZ>4?$numSubdivZ:4]
    set HWidth [expr $Width * 0.5]
    set HHeight [expr $Height * 0.5]
    # Rectangular Concrete
    patch rect $ConcreteTag $numSubdivY $numSubdivZ -$HWidth -$HHeight $HWidth $HHeight
}

# Beam As Fiber CORP Rect Section
proc Beam_As_Proc_1 { Width Height Cover Asup Asdown ReinforcementTag {diameter 20} } { 
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4 ]
    # Number of reinforcement in upper part or lower part
    set nup [int [ceil [expr $Asup/$Rein_Area]]]   
    set ndown [int [ceil [expr $Asdown/$Rein_Area]]]
    set nup [expr $nup>2?$nup:2]
    set ndown [expr $ndown>2?$ndown:2]
    # Get the Location of Corner Reinforcement
    set AsPos [expr $Height * 0.5 - $Cover]
    set AsWPos [expr $Width * 0.5 - $Cover]
    # Get the Area of each fiber
    set EachFiberAreaU [expr $Asup /$nup]
    set EachFiberAreaD [expr $Asdown /$ndown]
    # Top As Fiber
    layer straight $ReinforcementTag $nup $EachFiberAreaU -$AsWPos $AsPos  $AsWPos $AsPos 
    # Bottom As Fiber
    layer straight $ReinforcementTag $ndown $EachFiberAreaD -$AsWPos -$AsPos  $AsWPos -$AsPos 
}

# Column Fiber Section CORP YJK Section 1
proc Fiber_Section_Proc_1 { SecTag Width Height Cover As_corner As_mid_x As_mid_y ConcreteTag ReinforcementTag } {
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $Width $Height $Cover $ConcreteTag
        # As 
        Column_As_Proc_1 $Width $Height $Cover $As_corner $As_mid_x $As_mid_y $ReinforcementTag
    }
}

# Column As Fiber CORP Rect Section
proc Column_As_Proc_1 { Width Height Cover As_corner As_mid_x As_mid_y ReinforcementTag {diameter 20} } {
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4 ]
    # Number of reinforcement in Xdirection middle part or Ydirection middle part 
    set n_mid_x [int [ceil [expr $As_mid_x/$Rein_Area]]]
    set n_mid_x [expr $n_mid_x>1?$n_mid_x:1]
    set n_mid_y [int [ceil [expr $As_mid_y/$Rein_Area]]]
    set n_mid_y [expr $n_mid_y>1?$n_mid_y:1]
    set As_corner [expr [int $As_corner]]
    set AsPos [expr $Height * 0.5 - $Cover]
    set AsWPos [expr $Width * 0.5 - $Cover]
    set EachFiberAreaX [expr $As_mid_x / $n_mid_x]
    set EachFiberAreaY [expr $As_mid_y / $n_mid_y]
    set Space_mid_X [expr ($AsWPos * 2 ) /($n_mid_x + 1)]
    set Space_mid_Y [expr ($AsPos * 2 ) /($n_mid_y + 1)]
    set Start_mid_X [expr -$AsWPos + $Space_mid_X]
    set End_mid_X [expr $AsWPos - $Space_mid_X]
    set Start_mid_Y [expr -$AsPos + $Space_mid_Y]
    set End_mid_Y [expr $AsPos - $Space_mid_Y]    
    # Corner As At Down
    layer straight $ReinforcementTag 2 $As_corner -$AsWPos -$AsPos  $AsWPos -$AsPos 
    # Corner As At Top
    layer straight $ReinforcementTag 2 $As_corner -$AsWPos $AsPos  $AsWPos $AsPos 
    # X Dirct As At Down
    layer straight $ReinforcementTag $n_mid_x $EachFiberAreaX $Start_mid_X -$AsPos  $End_mid_X -$AsPos 
    # X Dirct As At Top
    layer straight $ReinforcementTag $n_mid_x $EachFiberAreaX $Start_mid_X $AsPos  $End_mid_X $AsPos     
    # Y Dirct As At Left   
    layer straight $ReinforcementTag $n_mid_y $EachFiberAreaY -$AsWPos $Start_mid_Y -$AsWPos $End_mid_Y
    # Y Dirct As At Right
    layer straight $ReinforcementTag $n_mid_y $EachFiberAreaY $AsWPos $Start_mid_Y $AsWPos $End_mid_Y
}

# Elasitc Section CORP YJK Section 1
proc Elastic_Section_Proc_1 { SecTag Width Height  ConTag  } {
    set HWidth [expr $Width * 0.5]
    set HHeight [expr $Height * 0.5]
    section Fiber $SecTag {
        patch rect $ConTag 4 4 -$HWidth -$HHeight $HWidth $HHeight
    }
}

# Beam or Column Fiber Section CORP YJK Section 2
proc Fiber_Section_Proc_2 { SecTag B H U T D F SteelTag } {
    section Fiber $SecTag {
        # theta0
        Steel_Proc_2 $B $H $U $T $D $F $SteelTag
    }
}

# Beam or Column Steel Fiber Section CORP 0
proc Steel_Proc_2 { B H U T D F SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_upper [int [ceil [expr $U/$Dividing_scale]]]
    set numSubdivZ_upper [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivY_web [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivZ_web [int [ceil [expr ($H-$T-$F)/$Dividing_scale]]]
    set numSubdivY_lower [int [ceil [expr $D/$Dividing_scale]]]
    set numSubdivZ_lower [int [ceil [expr $F/$Dividing_scale]]]
    # Define the Position of upper flange,Web_plate and lower flange
    set Upper_pos_y1 [expr -0.5*$U]
    set Upper_pos_z1 [expr 0.5*$H-$T]
    set Upper_pos_y2 [expr 0.5*$U]
    set Upper_pos_z2 [expr 0.5*$H]
    set Web_pos_y1 [expr -0.5*$B]
    set Web_pos_z1 [expr -0.5*$H+$F]
    set Web_pos_y2 [expr 0.5*$B]
    set Web_pos_z2 [expr 0.5*$H-$T]
    set Lower_pos_y1 [expr -0.5*$D]
    set Lower_pos_z1 [expr -0.5*$H]
    set Lower_pos_y2 [expr 0.5*$D]
    set Lower_pos_z2 [expr -0.5*$H+$F]
    # upper flange
    patch rect $SteelTag $numSubdivY_upper $numSubdivZ_upper $Upper_pos_y1 $Upper_pos_z1 $Upper_pos_y2 $Upper_pos_z2
    # Web_plate
    patch rect $SteelTag $numSubdivY_web $numSubdivZ_web $Web_pos_y1 $Web_pos_z1 $Web_pos_y2 $Web_pos_z2
    # lower flange
    patch rect $SteelTag $numSubdivY_lower $numSubdivZ_lower $Lower_pos_y1 $Lower_pos_z1 $Lower_pos_y2 $Lower_pos_z2
}

# Beam or Column Steel Fiber Section CORP 90
proc Steel_Proc_2_theta90 { B H U T D F SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_left [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivZ_left [int [ceil [expr $U/$Dividing_scale]]]
    set numSubdivY_web [int [ceil [expr ($H-$T-$F)/$Dividing_scale]]]
    set numSubdivZ_web [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivY_right [int [ceil [expr $F/$Dividing_scale]]]
    set numSubdivZ_right [int [ceil [expr $D/$Dividing_scale]]]
    # Define the Position of upper flange,Web_plate and lower flange
    set Left_pos_y1 [expr -0.5*$H]
    set Left_pos_z1 [expr -0.5*$U]
    set Left_pos_y2 [expr -0.5*$H+$T]
    set Left_pos_z2 [expr 0.5*$U]
    set Web_pos_y1 [expr -0.5*$H+$T]
    set Web_pos_z1 [expr -0.5*$B]
    set Web_pos_y2 [expr 0.5*$H-$F]
    set Web_pos_z2 [expr 0.5*$B]
    set Right_pos_y1 [expr 0.5*$H-$F]
    set Right_pos_z1 [expr -0.5*$D]
    set Right_pos_y2 [expr 0.5*$H]
    set Right_pos_z2 [expr 0.5*$D]
    # upper flange
    patch rect $SteelTag $numSubdivY_left $numSubdivZ_left $Left_pos_y1 $Left_pos_z1 $Left_pos_y2 $Left_pos_z2
    # Web_plate
    patch rect $SteelTag $numSubdivY_web $numSubdivZ_web $Web_pos_y1 $Web_pos_z1 $Web_pos_y2 $Web_pos_z2
    # lower flange
    patch rect $SteelTag $numSubdivY_right $numSubdivZ_right $Right_pos_y1 $Right_pos_z1 $Right_pos_y2 $Right_pos_z2
}

# Beam Fiber Section CORP YJK Section 3
proc Beam_Fiber_Section_Proc_3 { SecTag Diameter Cover Asup Asdown ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_circ_Proc_3 $Diameter $Cover $ConcreteTag
        # As 
        Beam_As_Proc_3 $Diameter $Cover $Asup $Asdown $ReinforcementTag
    }
}

# Circle concrete section
proc Concrete_circ_Proc_3 { Diameter Cover ConcreteTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local circ direction or rad direction
    set Dividing_scale double($Dividing_scale)
    set PI 3.141592653
    set Perimeter [expr $PI * $Diameter]
    set Radius [expr $Diameter/2]
    set numSubdivCirc [int [ceil [expr $Perimeter/$Dividing_scale]]]
    set numSubdivCirc [int [expr $numSubdivCirc>4?$numSubdivCirc:4]]
    set numSubdivRad [int [ceil [expr $Radius/$Dividing_scale]]]
    set numSubdivRad [int [expr $numSubdivRad>4?$numSubdivRad:4]]
    #puts $numSubdivCirc,$numSubdivRad
    # Circle Concrete
    patch circ $ConcreteTag $numSubdivCirc $numSubdivRad 0 0 0 $Radius 0 360
}

# Beam As Fiber CORP Rect Section
proc Beam_As_Proc_3 { Diameter Cover Asup Asdown ReinforcementTag {diameter 20} } { 
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4 ]
    # Number of reinforcement in upper part or lower part
    set nup [int [ceil [expr $Asup/$Rein_Area]]]
    set ndown [int [ceil [expr $Asdown/$Rein_Area]]]
    # Get the Location of Corner Reinforcement
    set AsPos [expr 0.4 * $Diameter - $Cover]
    set AsWPos [expr 0.3 * $Diameter - $Cover]
    # Get the Area of each fiber
    set EachFiberAreaU [expr $Asup /$nup]
    set EachFiberAreaD [expr $Asdown /$ndown]
    # Top As Fiber
    layer straight $ReinforcementTag $nup $EachFiberAreaU -$AsWPos $AsPos  $AsWPos $AsPos 
    # Bottom As Fiber
    layer straight $ReinforcementTag $ndown $EachFiberAreaD -$AsWPos -$AsPos  $AsWPos -$AsPos 
}

# Column Fiber Section CORP YJK Section 3
proc Fiber_Section_Proc_3 { SecTag Diameter Cover As_sum ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_circ_Proc_3 $Diameter $Cover $ConcreteTag
        # As
        Column_As_Proc_3 $Diameter $Cover $As_sum $ReinforcementTag
    }
}

# Column As Fiber CORP Rect Section
proc Column_As_Proc_3 { Diameter Cover As_sum ReinforcementTag {diameter 20} } {
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4]
    # Number of reinforcement
    set num [int [ceil [expr $As_sum/$Rein_Area]]]
    set num [expr $num>4?$num:4]
    # Get the Area of each fiber
    set EachFiberArea [expr $As_sum /$num]
    set pos_r [expr 0.5*$Diameter-$Cover]
    # reinforcement position
    layer circ $ReinforcementTag $num $EachFiberArea 0 0 $pos_r
}

# Beam or Column Fiber Section CORP YJK Section 5
proc Fiber_Section_Proc_5 { SecTag B H U T D F SteelTag } {
    section Fiber $SecTag {
        Steel_Proc_5 $B $H $U $T $D $F $SteelTag
    }
}

# Steel Fiber Section CORP 5
proc Steel_Proc_5 { B H U T D F SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_upper [int [ceil [expr abs($U)/$Dividing_scale]]]
    set numSubdivZ_upper [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivY_web [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivZ_web [int [ceil [expr $H/$Dividing_scale]]]
    set numSubdivY_lower [int [ceil [expr abs($D)/$Dividing_scale]]]
    set numSubdivZ_lower [int [ceil [expr $F/$Dividing_scale]]]
    # Define the Position of upper flange,Web_plate and lower flange
    set Upper_pos_y1 [expr $U>0?-0.5*$B-$U:0.5*$B]
    set Upper_pos_z1 [expr 0.5*$H-$T]
    set Upper_pos_y2 [expr $U>0?-0.5*$B:0.5*$B-$U]
    set Upper_pos_z2 [expr 0.5*$H]
    set Web_pos_y1 [expr -0.5*$B]
    set Web_pos_z1 [expr -0.5*$H]
    set Web_pos_y2 [expr 0.5*$B]
    set Web_pos_z2 [expr 0.5*$H]
    set Lower_pos_y1 [expr $D>0?-0.5*$B-$D:0.5*$B]
    set Lower_pos_z1 [expr -0.5*$H]
    set Lower_pos_y2 [expr $D>0?-0.5*$B:0.5*$B-$D]
    set Lower_pos_z2 [expr -0.5*$H+$F]
    # upper flange
    # puts "patch rect $SteelTag $numSubdivY_upper $numSubdivZ_upper $Upper_pos_y1 $Upper_pos_z1 $Upper_pos_y2 $Upper_pos_z2"
    patch rect $SteelTag $numSubdivY_upper $numSubdivZ_upper $Upper_pos_y1 $Upper_pos_z1 $Upper_pos_y2 $Upper_pos_z2
    # Web_plate
    # puts "patch rect $SteelTag $numSubdivY_web $numSubdivZ_web $Web_pos_y1 $Web_pos_z1 $Web_pos_y2 $Web_pos_z2"
    patch rect $SteelTag $numSubdivY_web $numSubdivZ_web $Web_pos_y1 $Web_pos_z1 $Web_pos_y2 $Web_pos_z2
    # lower flange
    # puts "patch rect $SteelTag $numSubdivY_lower $numSubdivZ_lower $Lower_pos_y1 $Lower_pos_z1 $Lower_pos_y2 $Lower_pos_z2"
    patch rect $SteelTag $numSubdivY_lower $numSubdivZ_lower $Lower_pos_y1 $Lower_pos_z1 $Lower_pos_y2 $Lower_pos_z2
}

# Beam Fiber Section CORP YJK Section 6,28,29
proc Beam_Fiber_Section_Proc_6 { SecTag B H U T D F Cover Asup Asdown ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_cross_Proc_6 $B $H $U $T $D $F $Cover $ConcreteTag
        # As
        Beam_As_Proc_6 $B $H $U $T $D $F $Cover $Asup $Asdown $ReinforcementTag
    }
}

proc Beam_Fiber_Section_Proc_28 { SecTag B H D F Cover Asup Asdown ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_L_Proc_28 $B $H $D $F $Cover $ConcreteTag
        # As
        Beam_As_Proc_28 $B $H $D $F $Cover $Asup $Asdown $ReinforcementTag
    }
}

proc Beam_Fiber_Section_Proc_29 { SecTag B H D F Cover Asup Asdown ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_T_Proc_29 $B $H $D $F $Cover $ConcreteTag
        # As
        Beam_As_Proc_29 $B $H $D $F $Cover $Asup $Asdown $ReinforcementTag
    }
}

proc Concrete_Proc_6_28_29 { B H U T D F Cover ConcreteTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_Left [int [ceil [expr $D/$Dividing_scale]]]
    set numSubdivY_Left [expr $numSubdivY_Left>4?$numSubdivY_Left:4]
    set numSubdivZ_Left [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivY_Middle [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivZ_Middle [int [ceil [expr $H/$Dividing_scale]]]
    set numSubdivZ_Middle [expr $numSubdivZ_Middle>4?$numSubdivZ_Middle:4]
    set numSubdivY_Right [int [ceil [expr $F/$Dividing_scale]]]
    set numSubdivY_Right [expr $numSubdivY_Right>4?$numSubdivY_Right:4]
    set numSubdivZ_Right $numSubdivZ_Left
    set WPos_middle_1 [expr -$B * 0.5]
    set WPos_middle_2 [expr $B * 0.5]
    set WPos_left_1 [expr -$D - $B * 0.5]
    set WPos_left_2 [expr -$B * 0.5]
    set WPos_right_1 [expr $B * 0.5]
    set WPos_right_2 [expr $B * 0.5 + $F]
    set Pos_middle_1 [expr -$H * 0.5]
    set Pos_middle_2 [expr $H * 0.5]
    set Pos_left_1 [expr $H * 0.5 - $U - $T]
    set Pos_left_2 [expr $H * 0.5 - $U]
    set Pos_right_1 [expr $H * 0.5 - $U - $T]
    set Pos_right_2 [expr $H * 0.5 - $U]
    # Concrete
    if {$D!=0} {
        # puts "patch rect $ConcreteTag $numSubdivY_Left $numSubdivZ_Left $WPos_left_1 $Pos_left_1 $WPos_left_2 $Pos_left_2"
        patch rect $ConcreteTag $numSubdivY_Left $numSubdivZ_Left $WPos_left_1 $Pos_left_1 $WPos_left_2 $Pos_left_2
    }    
    # puts "patch rect $ConcreteTag $numSubdivY_Middle $numSubdivZ_Middle $WPos_middle_1 $Pos_middle_1 $WPos_middle_2 $Pos_middle_2"
    patch rect $ConcreteTag $numSubdivY_Middle $numSubdivZ_Middle $WPos_middle_1 $Pos_middle_1 $WPos_middle_2 $Pos_middle_2
    if {$F!=0} {
        # puts "patch rect $ConcreteTag $numSubdivY_Right $numSubdivZ_Right $WPos_right_1 $Pos_right_1 $WPos_right_2 $Pos_right_2"
        patch rect $ConcreteTag $numSubdivY_Right $numSubdivZ_Right $WPos_right_1 $Pos_right_1 $WPos_right_2 $Pos_right_2
    }  
}

proc Concrete_cross_Proc_6 { B H U T D F Cover ConcreteTag } {
    Concrete_Proc_6_28_29 $B $H $U $T $D $F $Cover $ConcreteTag
}

proc Concrete_L_Proc_28 { B H D F Cover ConcreteTag } {
    set H1 [expr abs($H)]
    set U1 [expr $H>0?$H-$F:0]
    set D1 [expr $D>0?$D:0]
    set F1 [expr $D>0?0:-$D]
    Concrete_Proc_6_28_29 $B $H1 $U1 $F $D1 $F1 $Cover $ConcreteTag
}

proc Concrete_T_Proc_29 { B H D F Cover ConcreteTag } {
    set H1 [expr abs($H)]
    set U1 [expr $H>0?$H-$F:0]
    set D1 [expr 0.5*($D-$B)]  
    Concrete_Proc_6_28_29 $B $H1 $U1 $F $D1 $D1 $Cover $ConcreteTag
}

# Beam As Fiber CORP Rect Section
proc Beam_As_Proc_6 { B H U T D F Cover Asup Asdown ReinforcementTag {diameter 10} } { 
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4]
    # Number of reinforcement in upper part or lower part
    set nup [int [ceil [expr $Asup/$Rein_Area]]]
    set ndown [int [ceil [expr $Asdown/$Rein_Area]]]
    # Get the Location of Corner Reinforcement
    set AsPos [expr $H * 0.5 - $Cover]
    set AsWPos [expr $B * 0.5 - $Cover]
    # Get the Area of each fiber
    set EachFiberAreaU [expr $Asup /$nup]
    set EachFiberAreaD [expr $Asdown /$ndown]
    # Top As Fiber
    # puts "layer straight $ReinforcementTag $nup $EachFiberAreaU -$AsWPos $AsPos $AsWPos $AsPos"
    layer straight $ReinforcementTag $nup $EachFiberAreaU -$AsWPos $AsPos $AsWPos $AsPos
    # Bottom As Fiber
    # puts "layer straight $ReinforcementTag $ndown $EachFiberAreaD -$AsWPos -$AsPos $AsWPos -$AsPos"
    layer straight $ReinforcementTag $ndown $EachFiberAreaD -$AsWPos -$AsPos $AsWPos -$AsPos
}

# Beam As Fiber CORP Rect Section
proc Beam_As_Proc_28 { B H D F Cover Asup Asdown ReinforcementTag {diameter 10} } { 
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4]
    # Number of reinforcement in upper part or lower part
    set nup [int [ceil [expr $Asup/$Rein_Area]]]
    set ndown [int [ceil [expr $Asdown/$Rein_Area]]]
    # Get the Location of Corner Reinforcement
    if {$H>0} {
        set ypos_up_1 [expr -($B*0.5-$Cover)]
        set ypos_up_2 [expr $B*0.5-$Cover]
        set zpos_up [expr $H*0.5-$Cover]
        set ypos_down_1 [expr $D>0?-0.5*$B-$D+$Cover:-0.5*$B+$Cover]
        set ypos_down_2 [expr $D>0?0.5*$B-$Cover:0.5*$B-$D-$Cover]
        set zpos_down [expr -($H*0.5-$Cover)]        
    } else {
        set ypos_up_1 [expr $D>0?-0.5*$B-$D+$Cover:-0.5*$B]
        set ypos_up_2 [expr $D>0?0.5*$B:0.5*B-$D-$Cover]
        set zpos_up [expr -$H*0.5-$Cover]
        set ypos_down_1 [expr -($B*0.5-$Cover)]
        set ypos_down_2 [expr $B*0.5-$Cover]
        set zpos_down [expr $H*0.5+$Cover]
    }

    # Get the Area of each fiber
    set EachFiberAreaU [expr $Asup /$nup]
    set EachFiberAreaD [expr $Asdown /$ndown]
    # Top As Fiber
    # puts "layer straight $ReinforcementTag $nup $EachFiberAreaU $ypos_up_1 $zpos_up $ypos_up_2 $zpos_up"
    layer straight $ReinforcementTag $nup $EachFiberAreaU $ypos_up_1 $zpos_up $ypos_up_2 $zpos_up
    # Bottom As Fiber
    # puts "layer straight $ReinforcementTag $ndown $EachFiberAreaD $ypos_down_1 $zpos_down $ypos_down_2 $zpos_down"
    layer straight $ReinforcementTag $ndown $EachFiberAreaD $ypos_down_1 $zpos_down $ypos_down_2 $zpos_down
}

proc Beam_As_Proc_29 { B H D F Cover Asup Asdown ReinforcementTag {diameter 10} } { 
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4]
    # Number of reinforcement in upper part or lower part
    set nup [int [ceil [expr $Asup/$Rein_Area]]]
    set ndown [int [ceil [expr $Asdown/$Rein_Area]]]
    # Get the Location of Corner Reinforcement
    if {$H>0} {
        set ypos_up_1 [expr -($B*0.5-$Cover)]
        set ypos_up_2 [expr $B*0.5-$Cover]
        set zpos_up [expr $H*0.5-$Cover]
        set ypos_down_1 [expr -0.5*$D+$Cover]
        set ypos_down_2 [expr 0.5*$D-$Cover]
        set zpos_down [expr -($H*0.5-$Cover)]        
    } else {
        set ypos_up_1 [expr -0.5*$D+$Cover]
        set ypos_up_2 [expr 0.5*$D-$Cover]
        set zpos_up [expr -$H*0.5-$Cover]
        set ypos_down_1 [expr -$B*0.5+$Cover)]
        set ypos_down_2 [expr $B*0.5-$Cover]
        set zpos_down [expr $H*0.5+$Cover]
    }

    # Get the Area of each fiber
    set EachFiberAreaU [expr $Asup /$nup]
    set EachFiberAreaD [expr $Asdown /$ndown]
    # Top As Fiber
    # puts "layer straight $ReinforcementTag $nup $EachFiberAreaU $ypos_up_1 $zpos_up $ypos_up_2 $zpos_up"
    layer straight $ReinforcementTag $nup $EachFiberAreaU $ypos_up_1 $zpos_up $ypos_up_2 $zpos_up
    # Bottom As Fiber
    # puts "layer straight $ReinforcementTag $ndown $EachFiberAreaD $ypos_down_1 $zpos_down $ypos_down_2 $zpos_down"
    layer straight $ReinforcementTag $ndown $EachFiberAreaD $ypos_down_1 $zpos_down $ypos_down_2 $zpos_down
}

# Column Fiber Section CORP YJK Section 6
proc Fiber_Section_Proc_6 { SecTag B H U T D F Cover Asz Asf ConcreteTag ReinforcementTag {Dividing_scale 50} } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_cross_Proc_6 $B $H $U $T $D $F $Cover $ConcreteTag
        # As
        Column_As_Proc_6 $B $H $U $T $D $F $Cover $Asz $Asf $ReinforcementTag
    }
}

# Column Fiber Section CORP YJK Section 28
proc Fiber_Section_Proc_28 { SecTag B H D F Cover Asz Asf ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_L_Proc_28 $B $H $D $F $Cover $ConcreteTag
        # As
        Column_As_Proc_28 $B $H $D $F $Cover $Asz $Asf $ReinforcementTag
    }
}

# Column Fiber Section CORP YJK Section 29
proc Fiber_Section_Proc_29 { SecTag B H D F Cover Asz Asf ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_T_Proc_29 $B $H $D $F $Cover $ConcreteTag
        # As
        Column_As_Proc_29 $B $H $D $F $Cover $Asz $Asf $ReinforcementTag
    }
}

# Column As Fiber CORP Rect Section
proc Column_As_Proc_6 { B H U T D F Cover Asz Asf ReinforcementTag {diameter 20} } {
    set nz 12
    set EachFiberAreaZ [expr double($Asz) / $nz]
    # Distribution Bar Spacing
    set Space_DisBar 200.0
    ## Calculate the number of the distribution bar
    # left
    set nf1 [expr int(ceil($D/$Space_DisBar)-1)]
    # right
    set nf2 [expr int(ceil($F/$Space_DisBar)-1)]
    # up
    set nf3 [expr int(ceil($U/$Space_DisBar)-1)]
    # down
    set nf4 [expr int(ceil(($H - $U - $T)/$Space_DisBar)-1)]

    # Total of Distribution Bar
    set nf [expr 2 * ( $nf1 + $nf2 + $nf3 + $nf4 )]
    # Area of each distribution bar
    set EachFiberAreaF [expr double($Asf) / $nf]
    # position
    set AsPos_middle1 [expr $H * 0.5 - $U - $Cover]
    set AsPos_middle2 [expr $H * 0.5 - $U - $T + $Cover]
    set AsPos_up [expr $H * 0.5 - $Cover]
    set AsPos_down [expr -$H * 0.5 + $Cover]
    set AsWPos_middle [expr $B * 0.5 - $Cover]
    set AsWPos_left [expr -$B * 0.5 - $D + $Cover]
    set AsWPos_right [expr $B * 0.5 + $F - $Cover]
    set Space_left [expr $D/($nf1 + 1)]
    set Space_right [expr $F/($nf2 + 1)]
    set Space_up [expr $U/($nf3 + 1)]
    set Space_down [expr ($H - $U - $T) /($nf4 + 1)]
    if { $nf1 > 1 } {
        set Start_left [expr $AsWPos_left + $Space_left]
        set End_left [expr -$AsWPos_middle - $Space_left]
        # puts "layer straight $ReinforcementTag $nf1 $EachFiberAreaF $Start_left $AsPos_middle1 $End_left $AsPos_middle1"
        # puts "layer straight $ReinforcementTag $nf1 $EachFiberAreaF $Start_left $AsPos_middle2 $End_left $AsPos_middle2"
        layer straight $ReinforcementTag $nf1 $EachFiberAreaF $Start_left $AsPos_middle1 $End_left $AsPos_middle1
        layer straight $ReinforcementTag $nf1 $EachFiberAreaF $Start_left $AsPos_middle2 $End_left $AsPos_middle2
    } else {
        if { $nf1 == 1 } {
            set Start_left [expr $AsWPos_left + $Space_left]
            # puts "layer straight $ReinforcementTag 2 $EachFiberAreaF $Start_left $AsPos_middle1 $Start_left $AsPos_middle2"
            layer straight $ReinforcementTag 2 $EachFiberAreaF $Start_left $AsPos_middle1 $Start_left $AsPos_middle2
        }
    }
    if { $nf2 > 1 } {
        set Start_right [expr $AsWPos_middle + $Space_right]
        set End_right [expr $AsWPos_right - $Space_right]
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF $Start_right $AsPos_middle1 $End_right $AsPos_middle1"
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF $Start_right $AsPos_middle2 $End_right $AsPos_middle2"
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF $Start_right $AsPos_middle1 $End_right $AsPos_middle1
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF $Start_right $AsPos_middle2 $End_right $AsPos_middle2
    } else {
        if { $nf2 == 1 } {
            set Start_right [expr $AsWPos_right - $Space_right]
            # puts "layer straight $ReinforcementTag 2 $EachFiberAreaF $Start_right $AsPos_middle1 $Start_right $AsPos_middle2"
            layer straight $ReinforcementTag 2 $EachFiberAreaF $Start_right $AsPos_middle1 $Start_right $AsPos_middle2
        }
    }
    if { $nf3 > 1 } {
        set Start_up [expr $AsPos_up - $Space_up]
        set End_up [expr $AsPos_middle1 + $Space_up]
        # puts "layer straight $ReinforcementTag $nf3 $EachFiberAreaF $AsWPos_middle $Start_up $AsWPos_middle $End_up"
        # puts "layer straight $ReinforcementTag $nf3 $EachFiberAreaF -$AsWPos_middle $Start_up -$AsWPos_middle $End_up"
        layer straight $ReinforcementTag $nf3 $EachFiberAreaF $AsWPos_middle $Start_up $AsWPos_middle $End_up
        layer straight $ReinforcementTag $nf3 $EachFiberAreaF -$AsWPos_middle $Start_up -$AsWPos_middle $End_up
    } else {
        if { $nf3 == 1 } {
            set Start_up [expr $AsPos_up - $Space_up]
            # puts "layer straight $ReinforcementTag 2 $EachFiberAreaF -$AsWPos_middle $Start_up $AsWPos_middle $Start_up"
            layer straight $ReinforcementTag 2 $EachFiberAreaF -$AsWPos_middle $Start_up $AsWPos_middle $Start_up
        }
    }
    if { $nf4 > 1 } {
        set Start_down [expr $AsPos_down + $Space_down]
        set End_down [expr $AsPos_middle2 - $Space_down]
        # puts "layer straight $ReinforcementTag $nf4 $EachFiberAreaF $AsWPos_middle $Start_down $AsWPos_middle $End_down"
        # puts "layer straight $ReinforcementTag $nf4 $EachFiberAreaF -$AsWPos_middle $Start_down -$AsWPos_middle $End_down"
        layer straight $ReinforcementTag $nf4 $EachFiberAreaF $AsWPos_middle $Start_down $AsWPos_middle $End_down
        layer straight $ReinforcementTag $nf4 $EachFiberAreaF -$AsWPos_middle $Start_down -$AsWPos_middle $End_down
    } else {
        if { $nf4 == 1 } {
            set Start_up [expr $AsPos_up - $Space_up]
            # puts "layer straight $ReinforcementTag 2 $EachFiberAreaF -$AsWPos_middle $Start_down $AsWPos_middle $Start_down"
            layer straight $ReinforcementTag 2 $EachFiberAreaF -$AsWPos_middle $Start_down $AsWPos_middle $Start_down
        }
    }
    # up As
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_up $AsWPos_middle $AsPos_up"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_up $AsWPos_middle $AsPos_up
    # down As
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_down $AsWPos_middle $AsPos_down"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_down $AsWPos_middle $AsPos_down
    # left As
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ $AsWPos_left $AsPos_middle1 $AsWPos_left $AsPos_middle2"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ $AsWPos_left $AsPos_middle1 $AsWPos_left $AsPos_middle2
    # right As
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ $AsWPos_right $AsPos_middle1 $AsWPos_right $AsPos_middle2"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ $AsWPos_right $AsPos_middle1 $AsWPos_right $AsPos_middle2
    # middle As
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_middle1 $AsWPos_middle $AsPos_middle1"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_middle2 $AsWPos_middle $AsPos_middle2"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_middle1 $AsWPos_middle $AsPos_middle1
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_middle $AsPos_middle2 $AsWPos_middle $AsPos_middle2
}

# Column As Fiber CORP Section 28
proc Column_As_Proc_28 { B H D F Cover Asz Asf ReinforcementTag {diameter 20} } {
    set nz 8
    set EachFiberAreaZ [expr double($Asz) / $nz]
    # Distribution Bar Spacing
    set Space_DisBar 200.0
    ## Calculate the number of the distribution bar
    # web
    set nf1 [expr int(ceil((abs($H)-$F)/$Space_DisBar)-1)]
    # flange
    set nf2 [expr int(ceil(abs($D)/$Space_DisBar)-1)]

    # Total of Distribution Bar
    set nf [expr 2 * ( $nf1 + $nf2 )]
    # Area of each distribution bar
    set EachFiberAreaF [expr double($Asf) / $nf]
    # position and space
    # fixed bar
    set y_web [expr 0.5*$B-$Cover]
    set y_flange [expr $D>0?-0.5*$B-$D+$Cover:0.5*$B-$D-$Cover]   
    set z_up [expr 0.5*abs($H)-$Cover]
    set z_down [expr -0.5*abs($H)+$Cover]
    set z_middle [expr $H>0?-0.5*$H+$F-$Cover:-0.5*$H-$F+$Cover]
    
    # distributed bar
    set space_web [expr (abs($H)-$F)/($nf1+1)]
    set space_flange [expr abs($D)/($nf2+1)]
    set z_start_web [expr $H>0?$z_middle+$space_web:$z_down+$space_web]
    set z_end_web [expr $H>0?$z_up-$space_web:$z_middle-$space_web]
    set y_start_flange [expr $D>0?$y_flange+$space_flange:$y_web+$space_flange]
    set y_end_flange [expr $D>0?-$y_web-$space_flange:$y_flange-$space_flange]

    if {$nf1>0} {
        # puts "layer straight $ReinforcementTag $nf1 $EachFiberAreaF -$y_web $z_start_web -$y_web $z_end_web"
        # puts "layer straight $ReinforcementTag $nf1 $EachFiberAreaF $y_web $z_start_web $y_web $z_end_web"
        layer straight $ReinforcementTag $nf1 $EachFiberAreaF -$y_web $z_start_web -$y_web $z_end_web
        layer straight $ReinforcementTag $nf1 $EachFiberAreaF $y_web $z_start_web $y_web $z_end_web
    }

    if {$nf2>0} {
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_up $y_end_flange $z_up"
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_middle $y_end_flange $z_middle"
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_up $y_end_flange $z_up
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_middle $y_end_flange $z_middle
    }
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_up $y_web $z_up"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_middle $y_web $z_middle"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_down $y_web $z_down"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ $y_flange $z_middle $y_flange [expr $H>0?$z_down:$z_up]"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_up $y_web $z_up
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_middle $y_web $z_middle
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_down $y_web $z_down
    layer straight $ReinforcementTag 2 $EachFiberAreaZ $y_flange $z_middle $y_flange [expr $H>0?$z_down:$z_up]
}

# Column As Fiber CORP Section 29
proc Column_As_Proc_29 { B H D F Cover Asz Asf ReinforcementTag {diameter 20} } {
    set nz 10
    set EachFiberAreaZ [expr double($Asz) / $nz]
    # Distribution Bar Spacing
    set Space_DisBar 200.0
    ## Calculate the number of the distribution bar
    # web
    set nf1 [expr int(ceil((abs($H)-$F)/$Space_DisBar)-1)]
    # flange
    set nf2 [expr int(ceil(0.5*($D-$B)/$Space_DisBar)-1)]

    # Total of Distribution Bar
    set nf [expr 2 * $nf1 + 4*$nf2 ]
    # Area of each distribution bar
    set EachFiberAreaF [expr double($Asf) / $nf]
    # position and space
    # fixed bar
    set y_web [expr 0.5*$B-$Cover]
    set y_flange [expr 0.5*$D-$Cover]   
    set z_up [expr 0.5*abs($H)-$Cover]
    set z_down [expr -0.5*abs($H)+$Cover]
    set z_middle [expr $H>0?-0.5*$H+$F-$Cover:-0.5*$H-$F+$Cover]
    
    # distributed bar
    set space_web [expr (abs($H)-$F)/($nf1+1)]
    set space_flange [expr 0.5*($D-$B)/($nf2+1)]
    set z_start_web [expr $H>0?$z_middle+$space_web:$z_down+$space_web]
    set z_end_web [expr $H>0?$z_up-$space_web:$z_middle-$space_web]
    set y_start_flange [expr $y_web+$space_flange]
    set y_end_flange [expr $y_flange-$space_flange]

    if {$nf1>0} {
        # puts "layer straight $ReinforcementTag $nf1 $EachFiberAreaF -$y_web $z_start_web -$y_web $z_end_web"
        # puts "layer straight $ReinforcementTag $nf1 $EachFiberAreaF $y_web $z_start_web $y_web $z_end_web"
        layer straight $ReinforcementTag $nf1 $EachFiberAreaF -$y_web $z_start_web -$y_web $z_end_web
        layer straight $ReinforcementTag $nf1 $EachFiberAreaF $y_web $z_start_web $y_web $z_end_web
    }

    if {$nf2>0} {
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_up $y_end_flange $z_up"
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF -$y_start_flange $z_up -$y_end_flange $z_up"
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_middle $y_end_flange $z_middle"
        # puts "layer straight $ReinforcementTag $nf2 $EachFiberAreaF -$y_start_flange $z_middle -$y_end_flange $z_middle"
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_up $y_end_flange $z_up
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF -$y_start_flange $z_up -$y_end_flange $z_up
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF $y_start_flange $z_middle $y_end_flange $z_middle
        layer straight $ReinforcementTag $nf2 $EachFiberAreaF -$y_start_flange $z_middle -$y_end_flange $z_middle
    }
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_up $y_web $z_up"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_middle $y_web $z_middle"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_down $y_web $z_down"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_flange $z_middle -$y_flange [expr $H>0?$z_down:$z_up]"
    # puts "layer straight $ReinforcementTag 2 $EachFiberAreaZ $y_flange $z_middle $y_flange [expr $H>0?$z_down:$z_up]"
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_up $y_web $z_up
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_middle $y_web $z_middle
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_web $z_down $y_web $z_down
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$y_flange $z_middle -$y_flange [expr $H>0?$z_down:$z_up]
    layer straight $ReinforcementTag 2 $EachFiberAreaZ $y_flange $z_middle $y_flange [expr $H>0?$z_down:$z_up]
}

# Beam or Column Fiber Section CORP YJK Section 7
proc Fiber_Section_Proc_7 { SecTag B H U T D F SteelTag } {
    section Fiber $SecTag {
        Steel_Proc_7 $B $H $U $T $D $F $SteelTag
    }
}

proc Steel_Proc_7 { B H U T D F SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    # transform int to double
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_upper [int [ceil [expr $B/$Dividing_scale]]]   
    set numSubdivZ_upper [int [ceil [expr $U/$Dividing_scale]]]
    set numSubdivY_left [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivZ_left [int [ceil [expr ($H-$U-$D)/$Dividing_scale]]]
    set numSubdivY_right [int [ceil [expr $F/$Dividing_scale]]]
    set numSubdivZ_right $numSubdivZ_left
    set numSubdivY_lower $numSubdivY_upper
    set numSubdivZ_lower [int [ceil [expr $D/$Dividing_scale]]]
    # Define the Position of upper flange,Web_plate and lower flange
    set Upper_pos_y1 [expr -0.5*$B]
    set Upper_pos_z1 [expr 0.5*$H-$U]
    set Upper_pos_y2 [expr 0.5*$B]
    set Upper_pos_z2 [expr 0.5*$H]
    set Left_pos_y1 [expr -0.5*$B]
    set Left_pos_z1 [expr -0.5*$H+$D]
    set Left_pos_y2 [expr -0.5*$B+$T]
    set Left_pos_z2 [expr 0.5*$H-$U]
    set Right_pos_y1 [expr 0.5*$B-$F]
    set Right_pos_z1 [expr -0.5*$H+$D]
    set Right_pos_y2 [expr 0.5*$B]
    set Right_pos_z2 [expr 0.5*$H-$U]
    set Lower_pos_y1 [expr -0.5*$B]
    set Lower_pos_z1 [expr -0.5*$H]
    set Lower_pos_y2 [expr 0.5*$B]
    set Lower_pos_z2 [expr -0.5*$H+$D]
    # upper flange
    patch rect $SteelTag $numSubdivY_upper $numSubdivZ_upper $Upper_pos_y1 $Upper_pos_z1 $Upper_pos_y2 $Upper_pos_z2
    # left flange
    patch rect $SteelTag $numSubdivY_left $numSubdivZ_left $Left_pos_y1 $Left_pos_z1 $Left_pos_y2 $Left_pos_z2
    # right flange
    patch rect $SteelTag $numSubdivY_right $numSubdivZ_right $Right_pos_y1 $Right_pos_z1 $Right_pos_y2 $Right_pos_z2
    # lower flange
    patch rect $SteelTag $numSubdivY_lower $numSubdivZ_lower $Lower_pos_y1 $Lower_pos_z1 $Lower_pos_y2 $Lower_pos_z2

}

# Beam or Column Fiber Section CORP YJK Section 8
proc Fiber_Section_Proc_8 { SecTag B H SteelTag {Dividing_scale 50} } {
    section Fiber $SecTag {
        Steel_Proc_8 $B $H $SteelTag
    }
}

# Beam or Column Steel Fiber CORP Rect Section
proc Steel_Proc_8 { B H SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local circ direction or rad direction
    set Dividing_scale double($Dividing_scale)
    set PI 3.141592653
    set Perimeter [expr $PI * $B]
    set deltaRad [expr ($B-$H)/2]
    set extRad [expr $B/2]
    set intRad [expr $H/2]
    set numSubdivCirc [int [ceil [expr $Perimeter/$Dividing_scale]]]
    set numSubdivCirc [int [expr $numSubdivCirc>4?$numSubdivCirc:4]]
    set numSubdivRad [int [ceil [expr $deltaRad/$Dividing_scale]]]
    set numSubdivRad [int [expr $numSubdivRad>4?$numSubdivRad:4]]
    patch circ $SteelTag $numSubdivCirc $numSubdivRad 0 0 $intRad $extRad 0 360
}

# Beam or Column Fiber Section CORP YJK Section 9
proc Fiber_Section_Proc_9 { SecTag B H U T D F SteelTag } {
    section Fiber $SecTag {
        # theta0
        Steel_Proc_9 $B $H $U $T $D $F $SteelTag
        Steel_Proc_9_180 $B $H $U $T $D $F $SteelTag
    }
}

# Beam or Column Steel Fiber Section CORP 0
proc Steel_Proc_9 { B H U T D F SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_upper [int [ceil [expr $U/$Dividing_scale]]]
    set numSubdivZ_upper [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivY_web [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivZ_web [int [ceil [expr $H/$Dividing_scale]]]
    set numSubdivY_lower [int [ceil [expr $D/$Dividing_scale]]]
    set numSubdivZ_lower [int [ceil [expr $T/$Dividing_scale]]]
    # Define the Position of upper flange,Web_plate and lower flange
    set Upper_pos_y1 [expr -0.5*$F-$U-$B]
    set Upper_pos_z1 [expr 0.5*$H-$T]
    set Upper_pos_y2 [expr -0.5*$F-$B]
    set Upper_pos_z2 [expr 0.5*$H]
    set Web_pos_y1 [expr -0.5*$F-$B]
    set Web_pos_z1 [expr -0.5*$H]
    set Web_pos_y2 [expr -0.5*$F]
    set Web_pos_z2 [expr 0.5*$H]
    set Lower_pos_y1 [expr -0.5*$F-$U-$B]
    set Lower_pos_z1 [expr -0.5*$H]
    set Lower_pos_y2 [expr -0.5*$F-$B]
    set Lower_pos_z2 [expr -0.5*$H+$T]
    # upper flange
    patch rect $SteelTag $numSubdivY_upper $numSubdivZ_upper $Upper_pos_y1 $Upper_pos_z1 $Upper_pos_y2 $Upper_pos_z2
    # Web_plate
    patch rect $SteelTag $numSubdivY_web $numSubdivZ_web $Web_pos_y1 $Web_pos_z1 $Web_pos_y2 $Web_pos_z2
    # lower flange
    patch rect $SteelTag $numSubdivY_lower $numSubdivZ_lower $Lower_pos_y1 $Lower_pos_z1 $Lower_pos_y2 $Lower_pos_z2
}

# Beam or Column Steel Fiber Section CORP 180
proc Steel_Proc_9_180 { B H U T D F SteelTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY_upper [int [ceil [expr $U/$Dividing_scale]]]
    set numSubdivZ_upper [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivY_web [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivZ_web [int [ceil [expr $H/$Dividing_scale]]]
    set numSubdivY_lower [int [ceil [expr $D/$Dividing_scale]]]
    set numSubdivZ_lower [int [ceil [expr $T/$Dividing_scale]]]
    # Define the Position of upper flange,Web_plate and lower flange
    set Upper_pos_y1 [expr 0.5*$F+$B]
    set Upper_pos_z1 [expr 0.5*$H-$T]
    set Upper_pos_y2 [expr 0.5*$F+$U+$B]
    set Upper_pos_z2 [expr 0.5*$H]
    set Web_pos_y1 [expr 0.5*$F]
    set Web_pos_z1 [expr -0.5*$H]
    set Web_pos_y2 [expr 0.5*$F+$B]
    set Web_pos_z2 [expr 0.5*$H]
    set Lower_pos_y1 [expr 0.5*$F+$B]
    set Lower_pos_z1 [expr -0.5*$H]
    set Lower_pos_y2 [expr 0.5*$F+$U+$B]
    set Lower_pos_z2 [expr -0.5*$H+$T]
    # upper flange
    patch rect $SteelTag $numSubdivY_upper $numSubdivZ_upper $Upper_pos_y1 $Upper_pos_z1 $Upper_pos_y2 $Upper_pos_z2
    # Web_plate
    patch rect $SteelTag $numSubdivY_web $numSubdivZ_web $Web_pos_y1 $Web_pos_z1 $Web_pos_y2 $Web_pos_z2
    # lower flange
    patch rect $SteelTag $numSubdivY_lower $numSubdivZ_lower $Lower_pos_y1 $Lower_pos_z1 $Lower_pos_y2 $Lower_pos_z2
}

# Beam or Column Fiber Section CORP YJK Section 10
proc Fiber_Section_Proc_10 { SecTag B H T F U D L P SteelTag {Dividing_scale 50} } {
    section Fiber $SecTag {
        # theta0
        Steel_Proc_2 $B $H $F $T $F $T $SteelTag
        # theta90
        Steel_Proc_2_theta90 $U $D $P $L $P $L $SteelTag
    }
}

# Beam Fiber Section CORP YJK Section 11
proc Beam_Fiber_Section_Proc_11 { SecTag B H T F Cover Asup Asdown ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_Trap_Proc_11 $B $H $T $F $Cover $ConcreteTag
        # As 
        Beam_As_Proc_11 $B $H $T $F $Cover $Asup $Asdown $ReinforcementTag
    }
}

# Trapezoid Concrete Section
proc Concrete_Trap_Proc_11 { B H T F Cover ConcreteTag {Dividing_scale 50} } {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    set numSubdivY [int [ceil [expr ($B+$T+$F)/$Dividing_scale]]]
    set numSubdivY [expr $numSubdivY>4?$numSubdivY:4]
    set numSubdivZ [int [ceil [expr $H/$Dividing_scale]]]
    set numSubdivZ [expr $numSubdivZ>4?$numSubdivZ:4]
    set HWidth_up [expr ($B+$T+$F) * 0.5]
    set HWidth_down [expr $B * 0.5]
    set HHeight [expr $H * 0.5]
    # Trapezoid Concrete
    patch quad $ConcreteTag $numSubdivY $numSubdivZ -$HWidth_down -$HHeight $HWidth_down -$HHeight $HWidth_up $HHeight -$HWidth_up $HHeight
}

# Beam As Fiber CORP Trapezoid Section
proc Beam_As_Proc_11 { B H T F Cover Asup Asdown ReinforcementTag {diameter 20} } { 
    set PI 3.141592653
    set Rein_Area [expr $PI * $diameter * $diameter / 4 ]
    # Number of reinforcement in upper part or lower part
    set nup [int [ceil [expr $Asup/$Rein_Area]]]
    set ndown [int [ceil [expr $Asdown/$Rein_Area]]]
    # Get the Location of Corner Reinforcement
    set AsPos [expr $H * 0.5 - $Cover]
    set AsWPos_up [expr ($B+$T+$F) * 0.5 - $Cover]
    set AsWPos_down [expr $B * 0.5 - $Cover]
    # Get the Area of each fiber
    set EachFiberAreaU [expr $Asup /$nup]
    set EachFiberAreaD [expr $Asdown /$ndown]
    # Top As Fiber
    layer straight $ReinforcementTag $nup $EachFiberAreaU -$AsWPos_up $AsPos  $AsWPos_up $AsPos 
    # Bottom As Fiber
    layer straight $ReinforcementTag $ndown $EachFiberAreaD -$AsWPos_down -$AsPos  $AsWPos_down -$AsPos
}

# Column Fiber Section CORP YJK Section 11
proc Fiber_Section_Proc_11 { SecTag B H T F Cover Asz Asf ConcreteTag ReinforcementTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_Trap_Proc_11 $B $H $T $F $Cover $ConcreteTag
        # As 
        Column_As_Proc_11 $B $H $T $F $Cover $Asz $Asf $ReinforcementTag
    }
}

# Column As Fiber CORP Trapezoid Section
proc Column_As_Proc_11 { B H T F Cover Asz Asf ReinforcementTag {Distribution_space 150} } {
    set Distribution_space double($Distribution_space)
    set EachFiberAreaZ [int [expr $Asz/4]]
    set AsPos [expr $H * 0.5 - $Cover]
    set AsWPos_up [expr ($B + $T + $F) * 0.5 - $Cover]
    set AsWPos_down [expr $B * 0.5 - $Cover]
    set Space_left [expr [hypot $T $H] - 2 * $Cover]
    set Space_right [expr [hypot $F $H] -2 * $Cover]
    set nup [int [ceil [expr $AsWPos_up*2/$Distribution_space]]]
    set ndown [int [ceil [expr $AsWPos_down*2/$Distribution_space]]]
    set nleft [int [ceil [expr $Space_left/$Distribution_space]]]
    set nright [int [ceil [expr $Space_right/$Distribution_space]]]
    set EachFiberAreaF [expr [int [expr $Asf/($nup + $ndown + $nleft + $nright)]]]
    set Space_mid_up [expr ($AsWPos_up * 2 ) /($nup + 1)]
    set Space_mid_down [expr ($AsWPos_down * 2 ) /($ndown+ 1)]
    set Start_mid_up [expr -$AsWPos_up + $Space_mid_up]
    set End_mid_up [expr $AsWPos_up - $Space_mid_up]
    set Start_mid_down [expr -$AsWPos_down + $Space_mid_down]
    set End_mid_down [expr $AsWPos_down - $Space_mid_down]
    set Space_mid_left [expr $Space_left /($nleft + 1)]
    set Space_mid_right [expr $Space_right /($nright+ 1)]
    set Space_left_x [expr $Space_mid_left * $T / [hypot $T $H]]
    set Space_left_y [expr $Space_mid_left * $H / [hypot $T $H]]
    set Space_right_x [expr $Space_mid_right * $F / [hypot $F $H]]
    set Space_right_y [expr $Space_mid_right * $H / [hypot $F $H]]
    set Start_mid_left_x [expr -$AsWPos_down - $Space_left_x]
    set Start_mid_left_y [expr -$AsPos + $Space_left_y]
    set End_mid_left_x [expr -$AsWPos_up + $Space_left_x]
    set End_mid_left_y [expr $AsPos - $Space_left_y]
    set Start_mid_right_x [expr $AsWPos_down + $Space_mid_down]
    set Start_mid_right_y [expr -$AsPos + $Space_mid_down]
    set End_mid_right_x [expr $AsWPos_up - $Space_mid_down]
    set End_mid_right_y [expr $AsPos - $Space_mid_down]
    # Corner As At Down
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_down -$AsPos $AsWPos_down -$AsPos 
    # Corner As At Top
    layer straight $ReinforcementTag 2 $EachFiberAreaZ -$AsWPos_up $AsPos $AsWPos_up $AsPos 
    # X Dirct As At Down
    layer straight $ReinforcementTag $ndown $EachFiberAreaF $Start_mid_down -$AsPos $End_mid_down -$AsPos 
    # X Dirct As At Top
    layer straight $ReinforcementTag $nup $EachFiberAreaF $Start_mid_up $AsPos $End_mid_up $AsPos
    # Y Dirct As At Left   
    layer straight $ReinforcementTag $nleft $EachFiberAreaF $Start_mid_left_x $Start_mid_left_y $End_mid_left_x $End_mid_left_y
    # Y Dirct As At Right
    layer straight $ReinforcementTag $nright $EachFiberAreaF $Start_mid_right_x $Start_mid_right_y $End_mid_right_x $End_mid_right_y
}

# Beam or Column Fiber Section CORP YJK Section 12
proc Fiber_Section_Proc_12 { SecTag B H Cover ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_circ_Proc_3 $H $Cover $ConcreteTag
        # Tubular steel 
        Steel_Proc_8 $B $H $SteelTag
    }
}

# Beam Fiber Section CORP YJK Section 13
proc Beam_Fiber_Section_Proc_13 { SecTag B H U T D F Cover Asup Asdown ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag 
        # As
        Beam_As_Proc_1 $B $H $Cover $Asup $Asdown $ReinforcementTag
        # Tubular steel 
        Steel_Proc_2 $U $T $D $F $D $F $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 13
proc Fiber_Section_Proc_13 { SecTag B H U T D F Cover As_corner As_mid_x As_mid_y ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag 
        # As
        Column_As_Proc_1 $B $H $Cover $As_corner $As_mid_x $As_mid_y $ReinforcementTag
        # Tubular steel 
        Steel_Proc_2 $U $T $D $F $D $F $SteelTag
    }
}

# Beam Fiber Section CORP YJK Section 14
proc Beam_Fiber_Section_Proc_14 { SecTag B H U T D F Cover Asup Asdown ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section    
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag
        # As
        Beam_As_Proc_1 $B $H $Cover $Asup $Asdown $ReinforcementTag
        # tubular steel 
        Steel_Proc_7 $U $T $D $F $D $F $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 14
proc Fiber_Section_Proc_14 { SecTag B H U T D F Cover As_corner As_mid_x As_mid_y ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    # if -14
    if {$B==$U&&$H==$T} {
        Fiber_Section_Proc_-14 $SecTag $B $H $U $T $D $F $Cover $ConcreteTag $SteelTag
        return
    }
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag 
        # As
        Column_As_Proc_1 $B $H $Cover $As_corner $As_mid_x $As_mid_y $ReinforcementTag
        # tubular steel 
        Steel_Proc_7 $U $T $D $F $D $F $SteelTag
    }
}

# Beam or Column Fiber Section CORP YJK Section -14
proc Fiber_Section_Proc_-14 { SecTag B H U T D F Cover ConcreteTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 [expr $B-2*$F] [expr $H-2*$D] $Cover $ConcreteTag
        # Tubular steel 
        Steel_Proc_7 $U $T $D $F $D $F $SteelTag
    }
}

# Beam Fiber Section CORP YJK Section 15
proc Beam_Fiber_Section_Proc_15 { SecTag B H U T D F Cover Asup Asdown ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag
        # As
        Beam_As_Proc_1 $B $H $Cover $Asup $Asdown $ReinforcementTag
        # Inside steel 
        # theta0
        Steel_Proc_2 $U $D $F $T $F $T $SteelTag
        # theta90
        Steel_Proc_2_theta90 $U $D $F $T $F $T $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 15
proc Fiber_Section_Proc_15 { SecTag B H U T D F Cover As_corner As_mid_x As_mid_y ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag 
        # As
        Column_As_Proc_1 $B $H $Cover $As_corner $As_mid_x $As_mid_y $ReinforcementTag
        # Inside steel 
        # theta0
        Steel_Proc_2 $U $D $F $T $F $T $SteelTag
        # theta90
        Steel_Proc_2_theta90 $U $D $F $T $F $T $SteelTag
    }
}

# Beam or Column Fiber Section CORP YJK Section 24
proc Fiber_Section_Proc_24 { SecTag B H U T D F SteelTag {Dividing_scale 50}} {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    # Cover plate
    set numSubdivY1 [int [ceil [expr ($B - 2 * $U)/$Dividing_scale]]]
    set numSubdivY1 [expr $numSubdivY1>4?$numSubdivY1:4]
    set numSubdivZ1 [int [ceil [expr $F/$Dividing_scale]]]
    # Flange
    set numSubdivY2 [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivY2 [expr $numSubdivY2>4?$numSubdivY2:4]
    set numSubdivZ2 [int [ceil [expr $D/$Dividing_scale]]]
    # Web
    set numSubdivY3 [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivZ3 [int [ceil [expr ($H - 2 * $D)/$Dividing_scale]]]
    set numSubdivZ3 [expr $numSubdivZ3>4?$numSubdivZ3:4]
    set WPos_1 [expr $B * 0.5]
    set WPos_2 [expr $B * 0.5 - $U]
    set WPos_3 [expr $B * 0.5 - $U - $T]
    set Pos_1 [expr $H * 0.5 + $F]
    set Pos_2 [expr $H * 0.5]
    set Pos_3 [expr $H * 0.5 - $D]
    #Define Fiber Section
    section Fiber $SecTag {
        # upper cover plate
        patch rect $SteelTag $numSubdivY1 $numSubdivZ1 -$WPos_2 $Pos_2 $WPos_2 $Pos_1
        # lower cover plate
        patch rect $SteelTag $numSubdivY1 $numSubdivZ1 -$WPos_2 -$Pos_1 $WPos_2 -$Pos_2
        # upper flange
        patch rect $SteelTag $numSubdivY2 $numSubdivZ2 -$WPos_1 $Pos_3 $WPos_1 $Pos_2
        # lower flange
        patch rect $SteelTag $numSubdivY2 $numSubdivZ2 -$WPos_1 -$Pos_2 $WPos_1 -$Pos_3
        # left web
        patch rect $SteelTag $numSubdivY3 $numSubdivZ3 -$WPos_2 -$Pos_3 -$WPos_3 $Pos_3
        # right web
        patch rect $SteelTag $numSubdivY3 $numSubdivZ3 $WPos_3 -$Pos_3 $WPos_2 $Pos_3
    }
}

# Beam or Column Fiber Section CORP YJK Section 25
proc Fiber_Section_Proc_25 { SecTag B H U T D F SteelTag {Dividing_scale 50}} {
    # Define the number of subdivisions (fibers) in the local y direction or z direction
    set Dividing_scale double($Dividing_scale)
    # Extend the web
    set numSubdivY1 [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivZ1 [int [ceil [expr $F/$Dividing_scale]]]
    # Flange
    set numSubdivY2 [int [ceil [expr $B/$Dividing_scale]]]
    set numSubdivY2 [expr $numSubdivY2>4?$numSubdivY2:4]
    set numSubdivZ2 [int [ceil [expr $D/$Dividing_scale]]]
    # Web
    set numSubdivY3 [int [ceil [expr $T/$Dividing_scale]]]
    set numSubdivZ3 [int [ceil [expr ($H - 2 * $D)/$Dividing_scale]]]
    set numSubdivZ3 [expr $numSubdivZ3>4?$numSubdivZ3:4]
    set WPos_1 [expr $B * 0.5]
    set WPos_2 [expr $B * 0.5 - $U]
    set WPos_3 [expr $B * 0.5 - $U - $T]
    set Pos_1 [expr $H * 0.5 + $F]
    set Pos_2 [expr $H * 0.5]
    set Pos_3 [expr $H * 0.5 - $D]
    #Define Fiber Section
    section Fiber $SecTag {
        # upper cover plate
        patch rect $SteelTag $numSubdivY1 $numSubdivZ1 -$WPos_2 $Pos_2 -$WPos_3 $Pos_1
        patch rect $SteelTag $numSubdivY1 $numSubdivZ1 $WPos_3 $Pos_2 $WPos_2 $Pos_1
        # lower cover plate
        patch rect $SteelTag $numSubdivY1 $numSubdivZ1 -$WPos_2 -$Pos_1 -$WPos_3 -$Pos_2
        patch rect $SteelTag $numSubdivY1 $numSubdivZ1 $WPos_3 -$Pos_1 $WPos_2 -$Pos_2
        # upper flange
        patch rect $SteelTag $numSubdivY2 $numSubdivZ2 -$WPos_1 $Pos_3 $WPos_1 $Pos_2
        # lower flange
        patch rect $SteelTag $numSubdivY2 $numSubdivZ2 -$WPos_1 -$Pos_2 $WPos_1 -$Pos_3
        # left web
        patch rect $SteelTag $numSubdivY3 $numSubdivZ3 -$WPos_2 -$Pos_3 -$WPos_3 $Pos_3
        # right web
        patch rect $SteelTag $numSubdivY3 $numSubdivZ3 $WPos_3 -$Pos_3 $WPos_2 $Pos_3
    }
}

# Beam Fiber Section CORP YJK Section 101
proc Beam_Fiber_Section_Proc_101 { SecTag B H U T D F U1 T1 D1 F1 Cover Asup Asdown ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag
        # As
        Beam_As_Proc_1 $B $H $Cover $Asup $Asdown $ReinforcementTag
        # Inside steel 
        # theta0
        Steel_Proc_2 $U $D $F $T $F $T $SteelTag
        # theta90
        Steel_Proc_2_theta90 $U1 $D1 $F1 $T1 $F $T $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 101
proc Fiber_Section_Proc_101 { SecTag B H U T D F U1 T1 D1 F1 Cover As_corner As_mid_x As_mid_y ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag 
        # As
        Column_As_Proc_1 $B $H $Cover $As_corner $As_mid_x $As_mid_y $ReinforcementTag
        # Inside steel 
        # theta0
        Steel_Proc_2 $U $D $F $T $F $T $SteelTag
        # theta90
        Steel_Proc_2_theta90 $U1 $D1 $F1 $T1 $F $T $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 102
proc Fiber_Section_Proc_102 { SecTag B H U T Cover As_corner As_mid_x As_mid_y ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_rect_Proc_1 $B $H $Cover $ConcreteTag 
        # As
        Column_As_Proc_1 $B $H $Cover $As_corner $As_mid_x $As_mid_y $ReinforcementTag
        # Tubular steel 
        Steel_Proc_8 $U $T $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 103
proc Fiber_Section_Proc_103 { SecTag B U T D F Cover As_sum ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_circ_Proc_3 $B $Cover $ConcreteTag 
        # As
        Column_As_Proc_3 $B $Cover $As_sum $ReinforcementTag
        # Inside steel 
        Steel_Proc_2 $U $T $D $F $D $F $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 104
proc Fiber_Section_Proc_104 { SecTag B H D Cover As_sum ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_circ_Proc_3 $B $Cover $ConcreteTag 
        # As
        Column_As_Proc_3 $B $Cover $As_sum $ReinforcementTag
        # Tubular steel 
        Steel_Proc_8 $H $D $SteelTag
    }
}

# Column Fiber Section CORP YJK Section 104
proc Fiber_Section_Proc_105 { SecTag B U T D F U1 T1 D1 F1 Cover As_sum ConcreteTag ReinforcementTag SteelTag } {
    #Define Fiber Section
    section Fiber $SecTag {
        # Concrete
        Concrete_circ_Proc_3 $B $Cover $ConcreteTag 
        # As
        Column_As_Proc_3 $B $Cover $As_sum $ReinforcementTag
        # Inside steel 
        # theta0
        Steel_Proc_2 $U $D $F $T $F $T $SteelTag
        # theta90
        Steel_Proc_2_theta90 $U1 $D1 $F1 $T1 $F $T $SteelTag
    }
}